package com.hsylient.springboot.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class ValidateRequest {

    @Schema(description = "姓名")
    @NotBlank(message = "姓名不能为空")
    private String name;

    @Schema(description = "年龄")
    @Min(value = 0, message = "年龄最小只能为0")
    @Max(value = 200, message = "年龄最大只能为200")
    private Integer age;

    @Schema(description = "生日")
    // 适用于post请求
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date birthday;

    @Schema(description = "薪水")
    @DecimalMax(value = "1000000", message = "薪水不能大于一千万")
    private BigDecimal salary;

}
